import java.util.Scanner;

/**
 * 接受一个由字母和数字组成的字符串，和一个字符，然后输出输入字符串中含有该字符的个数。不区分大小写。
 * Created by JiaJia on 2019/6/19 0019.
 */
public class HuaWei002 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        while (scanner.hasNext()){
            String str=scanner.nextLine();
            String ch=scanner.nextLine();
            System.out.println(countCharNumber(str,ch));
        }
        scanner.close();
    }
    private static int countCharNumber(String string,String ch){
        int count=0;
        for (int i = 0; i <string.length() ; i++) {
            if (string.substring(i,i+1).equalsIgnoreCase(ch))
                count++;
        }
        return count;
    }
}